<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

require(APPPATH . 'core/admin.php');

class Messages extends Admin
{
    public function getPage()
    {
        return 'messages';
    }

    public function getMoreData()
    {
        $sql = "SELECT users.sName AS sFrom, sContent, dTime FROM messages LEFT JOIN users ON users.nId = messages.nSenderId WHERE nReceiverId = ?";
        $query = $this->db->query($sql, array($this->session->userdata('userId')));
        $data['messages'] = $query->row_array();

        return $data;
    }
}